package kr.hkit.bsnsalemgn;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.GridLayout;

import kr.hkit.bsnsalemgn.inputUI.AbsInputBaseUI;

public class BusinessSaleMgn extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					BusinessSaleMgn frame = new BusinessSaleMgn();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public BusinessSaleMgn() {
		initialize();
	}
	private void initialize() {
		setTitle("\uAC70\uB798\uCC98 \uC601\uC5C5\uAD00\uB9AC \uD504\uB85C\uADF8\uB7A8");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		
		JMenuBar menuBar = new JMenuBar();
		setJMenuBar(menuBar);
		
		JMenu baseMenu = new JMenu("\uAE30\uCD08\uC790\uB8CC\uAD00\uB9AC");
		menuBar.add(baseMenu);
		
		JMenuItem empMenuItem = new JMenuItem("\uC601\uC5C5\uC0AC\uC6D0\uAD00\uB9AC");
		empMenuItem.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handle_empMenuItem_actionPerformed(e);
			}
		});
		baseMenu.add(empMenuItem);
		
		JMenuItem pdtMenuItem = new JMenuItem("\uC81C\uD488\uAD00\uB9AC");
		pdtMenuItem.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handle_pdtMenuItem_actionPerformed(e);
			}
		});
		baseMenu.add(pdtMenuItem);
		
		JMenuItem bsnMenuItem = new JMenuItem("\uAC70\uB798\uCC98\uAD00\uB9AC");
		bsnMenuItem.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handle_bsnMenuItem_actionPerformed(e);
			}
		});
		baseMenu.add(bsnMenuItem);
		
		JMenu saleMgnMenu = new JMenu("\uD310\uB9E4\uAD00\uB9AC");
		menuBar.add(saleMgnMenu);
		
		JMenuItem saleMenuItem = new JMenuItem("\uD310\uB9E4\uAD00\uB9AC");
		saleMenuItem.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handle_saleMenuItem_actionPerformed(e);
			}
		});
		saleMgnMenu.add(saleMenuItem);
		
		JMenu queryMenu = new JMenu("\uC870\uD68C\uC5C5\uBB34");
		menuBar.add(queryMenu);
		
		JMenuItem empMenuItem_1 = new JMenuItem("\uC601\uC5C5\uC0AC\uC6D0\uD604\uD669");
		empMenuItem_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handle_empMenuItem_1_actionPerformed(e);
			}
		});
		queryMenu.add(empMenuItem_1);
		
		JMenuItem pdtMenuItem_1 = new JMenuItem("\uC81C\uD488\uD604\uD669");
		pdtMenuItem_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handle_pdtMenuItem_1_actionPerformed(e);
			}
		});
		queryMenu.add(pdtMenuItem_1);
		
		JMenuItem bsnMenuItem_1 = new JMenuItem("\uAC70\uB798\uCC98\uD604\uD669");
		bsnMenuItem_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handle_bsnMenuItem_1_actionPerformed(e);
			}
		});
		queryMenu.add(bsnMenuItem_1);
		
		JMenuItem bsnhistoryMenuItem = new JMenuItem("\uAC70\uB798\uCC98\uBCC4 \uAC70\uB798 \uD604\uD669");
		bsnhistoryMenuItem.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handle_bsnhistoryMenuItem_actionPerformed(e);
			}
		});
		queryMenu.add(bsnhistoryMenuItem);
		
		JMenuItem pdthistoryMenuItem = new JMenuItem("\uC81C\uD488\uBCC4 \uAC70\uB798 \uD604\uD669");
		pdthistoryMenuItem.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handle_pdthistoryMenuItem_actionPerformed(e);
			}
		});
		queryMenu.add(pdthistoryMenuItem);
		
		JMenuItem emphistoryMenuItem = new JMenuItem("\uC601\uC5C5\uC0AC\uC6D0 \uAC70\uB798 \uD604\uD669");
		emphistoryMenuItem.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				handle_emphistoryMenuItem_actionPerformed(e);
			}
		});
		queryMenu.add(emphistoryMenuItem);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		JPanel panel = new JPanel();
		contentPane.add(panel, BorderLayout.CENTER);
		panel.setLayout(new GridLayout(0, 2, 0, 0));
	}

	protected void handle_empMenuItem_actionPerformed(ActionEvent e) {
		AbsInputBaseUI test = new AbsInputBaseUI(0,0) {
			@Override
			protected void btnSearchActionPerformed(ActionEvent e) {}			
			@Override
			protected void btnSaveActionPerformed(ActionEvent e) {}			
			@Override
			protected void btnDelActionPerformed(ActionEvent e) {}
		};
		//test.setVisible(true);
		contentPane.removeAll();
		contentPane.add(test);
		contentPane.revalidate();
		JOptionPane.showConfirmDialog(null, "영업사원관리");
	}
	
	protected void handle_bsnMenuItem_actionPerformed(ActionEvent e) {
		JOptionPane.showConfirmDialog(null, "거래처관리");
	}
	protected void handle_pdtMenuItem_actionPerformed(ActionEvent e) {
		AbsInputBaseUI test = new AbsInputBaseUI(1,-1) {
			@Override
			protected void btnSearchActionPerformed(ActionEvent e) {}			
			@Override
			protected void btnSaveActionPerformed(ActionEvent e) {}			
			@Override
			protected void btnDelActionPerformed(ActionEvent e) {}
		};
		test.setVisible(true);
		contentPane.removeAll();
		contentPane.add(test);
		contentPane.revalidate();
		JOptionPane.showConfirmDialog(null, "제품관리");
	}
	protected void handle_pdthistoryMenuItem_actionPerformed(ActionEvent e) {
		JOptionPane.showConfirmDialog(null, "제품별 거래현황");
	}
	protected void handle_bsnhistoryMenuItem_actionPerformed(ActionEvent e) {
		JOptionPane.showConfirmDialog(null, "거래처별 거래현황");
	}
	protected void handle_empMenuItem_1_actionPerformed(ActionEvent e) {
		JOptionPane.showConfirmDialog(null, "영업사원현황");
	}
	protected void handle_emphistoryMenuItem_actionPerformed(ActionEvent e) {
		JOptionPane.showConfirmDialog(null, "영업사원별 거래현황");
	}
	protected void handle_bsnMenuItem_1_actionPerformed(ActionEvent e) {
		JOptionPane.showConfirmDialog(null, "거래처현황");
	}
	protected void handle_pdtMenuItem_1_actionPerformed(ActionEvent e) {
		JOptionPane.showConfirmDialog(null, "제품현황");
	}
	protected void handle_saleMenuItem_actionPerformed(ActionEvent e) {
		JOptionPane.showConfirmDialog(null, "판매관리");
	}
}